package com.runtime.hongyunuser.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.runtime.hongyunuser.bean.Carousels;
import com.runtime.hongyunuser.bean.Categories;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Locale;

@Mapper
public interface CategoriesMapper extends BaseMapper<Categories> {

    // 查询所有分类
//    @Select("SELECT * FROM categories ORDER BY sortOrder ASC")
    List<Categories> selectAllCategories();

    // 查询一级分类
//    @Select("SELECT * FROM categories WHERE parentId IS NULL ORDER BY sortOrder ASC")
    List<Categories> selectRootCategories();

    // 查询子分类
//    @Select("SELECT * FROM categories WHERE parentId = #{parentId} ORDER BY sortOrder ASC")
    List<Categories> selectChildCategories(Integer parentId);

    List<Carousels> findAllActive(String currentDate);


}
